package com.sptechsys.m2ejb32weblogic.ejb3.demo.ws.client;
import java.io.IOException;

import javax.xml.rpc.ServiceException;

public class Main{

  public static void main( String[] args ){

   testWs("http://localhost:7001/m2ejb32weblogic-ws/HelloWorldServiceImpl?WSDL");
  }

  public static void testWs( String wsdlUrl ){
    try{
        System.out.println( "Start first method");
    	HelloWorldService_Impl helloWorldService_Impl = new HelloWorldService_Impl();
    	String message=helloWorldService_Impl.getHelloWorldPortTypeSoapPort().sayHelloToEjb("Test");
    	System.out.println( "first method:sayHelloToEjb:"+message);
        System.out.println( "Start second method");
    	HelloWorldService service = null;
    	if(wsdlUrl==null){
    		service=new HelloWorldService_Impl();
    	}else{
    		service=new HelloWorldService_Impl( wsdlUrl );
    	}
      
      HelloWorldPortType port = service.getHelloWorldPortTypeSoapPort();
      message=port.sayHelloWorld("Test") ;
      System.out.println( "second method:sayHelloWorld:"+message);
    }catch( IOException e ){
      System.out.println( "Failed to create web service client:" + e );
    }catch( ServiceException e ){
      System.out.println( "Failed to create web service client:" + e );
    }
  }
}
